<?php

namespace app\common\shop;

use think\Db;
use think\Model;
use think\model\concern\SoftDelete;

// 收货地址
class RealNameModel extends model {
    // 完整数据表名
    protected $table = 'real_name';

    /**
     * [建表]
     * @return
     */
    public static function createTable(){
        return Db::query("Create Table If Not Exists `real_name`(
             `id` int(11) NOT NULL AUTO_INCREMENT,
             `uid` int(11) NOT NULL COMMENT '会员id',
             `realname` varchar(255) NOT NULL COMMENT '姓名',
             `card` varchar(255) NOT NULL COMMENT '身份证号',
             `status` int(1) not  null default 0 COMMENT '审核状态',
             `createtime` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '时间',
             `finishtime` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '审核时间',
             PRIMARY KEY (`id`)
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='实名申请表'");
    }

    /**
     * [添加]
     * @return
     */
    public static function add($data){
        $data['createtime'] = time();
        return self::insertGetId($data);
    }

    /**
     * [获取审核状态]
     * @param
     * @return
     */
    public static function getInfo($id){
        return self::where('id',$id)->find();
    }
}